home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / basic / PureBasic.lha / PureBasic_Demo / PureBasic / Examples / FullVersion_Sources / Picture.pb < prev    next >
Encoding:
Text File  |  2000-03-19  |  1.2 KB  |  67 lines

  1. ;
  2. ; ***********************************
  3. ;
  4. ; Picture example file for Pure Basic
  5. ;
  6. ;    © 1999 - Fantaisie Software -
  7. ;
  8. ; ***********************************
  9. ;
  10. ;
  11.  
  12. InitPicture(0)
  13. InitRequester()
  14. InitBitMap(0)
  15. InitScreen(0)
  16. InitWindow(0)
  17. InitPalette(2)
  18.  
  19. FindScreen(0,"")
  20.  
  21. PrintN("Choose a picture...")
  22.  
  23. FileName$ = FileRequester(0)
  24.  
  25. If FileName$ <> ""
  26.   res.l = LoadPicture(0,FileName$)
  27.  
  28.   If res>0
  29.  
  30.     PrintN ("Picture information: "+Str(PictureWidth())+"*"+Str(PictureHeight())+"*"+Str(PictureDepth()))
  31.  
  32.     AllocateBitMap (0, PictureWidth(), PictureHeight(), PictureDepth())
  33.  
  34.     PictureToBitMap(0, BitMapID())
  35.  
  36.     GetScreenPalette(0, ScreenID())
  37.  
  38.     CreatePalette (2,1 LSL ScreenDepth())            ; Put the display black
  39.     DisplayPalette(2, ScreenID())   ;
  40.  
  41.     If OpenWindow (0, 0, 0, ScreenWidth(), ScreenHeight(), #WFLG_BORDERLESS, 0)
  42.  
  43.       DrawingOutput(WindowRastPort())
  44.  
  45.       GetPicturePalette (1, PictureID())
  46.  
  47.       x.w = (ScreenWidth()  - PictureWidth() )/2
  48.       y.w = (ScreenHeight() - PictureHeight())/2
  49.  
  50.       If x<0 : x=0 : EndIf
  51.       If y<0 : y=0 : EndIf
  52.  
  53.       DisplayPalette(1, ScreenID())
  54.  
  55.       CopyBitMap(BitMapID(),0,0,x,y,PictureWidth(), PictureHeight())
  56.  
  57.       MouseWait()
  58.  
  59.     EndIf
  60.  
  61.     DisplayPalette (0, ScreenID())
  62.  
  63.   EndIf
  64. Endif
  65.  
  66. End
  67.